import request from '../../utils/request'


/**
 * 创建收款账户
 * @param params
 * @returns {Promise.<void>}
 */
export async function addPayer(data) {
    return request(apiPath.imagent + "/api/payer", {
        method: 'post',
        data
    });
}

/**
 * 修改收款账户
 * @param params
 * @returns {Promise.<void>}
 */
export async function updatePayer(data) {
    return request(apiPath.imagent + "/api/payer", {
        method: 'put',
        data
    });
}

/**
 * 删除收款账户
 * @param id
 * @returns {Promise.<void>}
 */
export async function deleteById({id}) {
    return request(apiPath.imagent + "/api/payer/"+ id, {
        method: 'delete'
    });
}



/**
 * 获取单个详情
 * @param id
 * @returns {Promise.<void>}
 */
export async function getById({id}) {
    return request(apiPath.imagent + "/api/payer/"+ id, {
        method: 'get'
    });
}

/**
 * 获取境外贸易商收款人列表
 * @param cstId
 * @param page
 * @returns {Promise.<void>}
 */
export async function getOutbuyPayerList({providerId, page}) {
    return request(apiPath.imagent + "/api/payer", {
        method: 'get',
        data: { providerId, page: page.page, size: page.size}
    });
}

/**
 * 获取境外贸易商收款人下拉列表
 *
 * @param cstId
 * @param status
 * @returns {Promise.<Object>}
 */
export async function queryOutbuyPayerListById({providerId}) {
    return request(apiPath.imagent + "/api/payer/provider/" + providerId, {
        method: 'GET',
        data: {providerId}
    });
}